home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 15891 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  759 b 

  1. Path: alterdial.uu.net!not-for-mail
  2. From: Chris Gould <cgould@dataware.com>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: [HELP!!!] Segmentation Fault!
  5. Date: Mon, 08 Apr 1996 14:49:22 -0400
  6. Organization: Dataware Technologies, Inc.
  7. Message-ID: <31695FB2.31@dataware.com>
  8. References: <4k4gja$mm@nuscc.nus.sg>
  9. NNTP-Posting-Host: gw.dataware.com
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0 (WinNT; I)
  14.  
  15. In ReadNextField you are returning a pointer to a local variable (str.)  
  16.  
  17. char* SpaceStudentFile::readNextField()
  18. {
  19.   char str[40];
  20.  
  21. ...
  22.         return str;
  23. ...
  24. }
  25.  
  26. The pointer you return is therefore invalid.  Either pass storage into this function 
  27. or allocate new storage inside the function.
  28.